function initOrderSpeed(){
    var dom1=document.getElementById('order-speed');
    var myChart1=echarts.init(dom1);
    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            top:10,
            left: '3%',
            right: '4%',
            bottom: '30',
            containLabel: true
        },
        xAxis: [
            {
                "axisLabel":{     //加上这个强制显示
                    interval: 0
                  },
                type: 'category',
                data: ['最大速度', '最小速度', '平均速度'],
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis: [
            {
                type: 'value'
            }
        ],
        series: [
            {
                name: 'speed',
                type: 'bar',
                barWidth: '40%',
                data: [120,10,50]
            }
        ]
    };
    myChart1.setOption(option);
    return myChart1;
}
function initOrderIdling(){
    var dom2=document.getElementById('order-idling');
    var myChart2=echarts.init(dom2);
    var option = {
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            top:10,
            left: '3%',
            right: '4%',
            bottom: '30',
            containLabel: true
        },
        xAxis: [
            {
                "axisLabel":{     //加上这个强制显示
                    interval: 0
                  },
                type: 'category',
                data: ['最大速度', '最小速度', '平均速度'],
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis: [
            {
                type: 'value'
            }
        ],
        series: [
            {
                name: 'minute',
                type: 'bar',
                barWidth: '40%',
                data: [20,5,8]
            }
        ]
    };
    myChart2.setOption(option);
    return myChart2;
}



function resizeAllCharts(){
    //resize方式2
    // var compareChart = echarts.getInstanceByDom(document.getElementById("time-usingcar"));
    // compareChart.resize();

    var allChartsDom = document.getElementsByClassName("speed-chart");//class
    for (var i = 0; i < allChartsDom.length; i++) {
        var chatsDom = allChartsDom[i];
        var compareChart = echarts.getInstanceByDom(chatsDom);
        if(compareChart){
            compareChart.resize();
        }
    }

}
window.onload = function(){
    initOrderSpeed();
    initOrderIdling();
    
};
window.onresize = function(){
    resizeAllCharts();
};